<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>

    <body>
        <script>
            // 使用for循环 - 求出数组里大于5的数和 [4, 9, 5, 20, 3, 11]

            let num = [4, 9, 5, 20, 3, 11];
            let sum = 0;
            for (let i = 0; i < num.length; i++) {
                if (num[i] > 5) {
                    sum += num[i];
                }
            }
            document.write(`数组里大于5的数和为：${sum}`);
        </script>
    </body>
</html>
